<?php
session_start();
require '../config.php';
error_reporting(5);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="zh-cn" xmlns="http://www.w33.org/1999/xhtml"></html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
	<title>旧衣物回收</title>
	<link rel="stylesheet" type="text/css" href="../css/top.css" charset=utf-8>
	<link rel="stylesheet" type="text/css" href="./css/login.css" charset=utf-8>
	<script type="text/javascript" src="../js/jquery-1.11.0.js"></script>
</head>


<body>
	<?php require 'top.php';?>
	<div class="open">继续注册</div>
<div class="modal" style="height: 600px;">

	<div class="form" style="height: 600px;">
	<form method="post" name="form_reg" action="checkreg.php">
		<!-- action="checkreg.php" -->
		<label>邮箱</label>
		<input id="uemail" type="email" required="required" name="uemail">
		<label for="pass">密码</label>
		<input id="pword1" type="password" required="required" name="pword1">
		<label for="pass">确认密码</label>
		<input id="pword2" type="password" required="required" name="pword2">
		<label for="username">昵称</label>
		<input id="uname" type="text" required="required" name="uname">
		<label for="uphone">手机</label>
		<input id="uphone" type="text" required="required" name="uphone">
		<label for="uaddress">地址</label>
		<input id="uaddress" type="text" required="required" name="uaddress">
		<button type="submit" onclick="return check(); ">注册</button>
	
	</form>
    </div>
<div class="invite">
	<h3>欢迎使用旧衣物回收与交易平台，注册即享多重好礼。</h3>
	<div class="nope1"><a href="index.php" style="color: #fff;">登录</a></div>
	<div class="nope" style="margin-left: 95px">暂不注册</div>
	<div title="关闭" class="close"></div>

</div>
</div>

<script src="js/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
	// 点击close和nope盒子，modal盒子增加hidden的CSS样式，open盒子增加active的CSS样式
	$(".close, .nope").on('click', function () {    
		$('.modal').addClass('hidden');       
		$('.open').addClass('active');    
	})    
	// 点击open盒子，open盒子去除active的CSS样式 ，modal盒子去除hidden的CSS样式
	$(".open").on('click', function () {
		$(this).removeClass('active');
		$('.modal').removeClass('hidden');
	})
</script>


<script type="text/javascript">
	function check(){
		// 检查密码
		if(document.form_reg.pword1.value=="")
		{
			alert("请输入密码");
			document.form_reg.pword1.focus();
			// 光标焦点聚焦到密码框内
			return false;
		}
		var upword1 = document.form_reg.pword1.value;
		var a=/^.*(?=.{6,16})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*? ]).*$/;
		// 正则表达式：表示长度为6-16位包含数字+字母，可以包含或不包含特殊符号的密码
		if(!(a.test(upword1))){
			alert("密码格式错误，请输入长度为6-16位包含数字+大小写字母+特殊符号的密码");
			document.getElementById("pword1").value="";
			document.form_reg.pword1.focus();
			return false;
		}
		// 检查确认密码
		if (document.form_reg.pword2.value=="")
		 {
		 	alert("请确认密码");
		 	document.form_reg.pword2.focus();
		 	return false;
		 }
		 if(document.form_reg.pword1.value!=form_reg.pword2.value)
		 {
		 	alert("密码不一致，请重试");
		 	document.getElementById("pword2").value="";
		 	document.form_reg.pword2.focus();
		 	return false;
		 }

		 // 检查昵称
		 if (document.form_reg.uname.value=="") {
		 	alert("请输入昵称");
		 	document.form_reg.uname.focus();
		 	return false;
		 }
		 var uname = document.form_reg.uname.value;
		 var b=/^.{2,12}$/;
		 if(!(b.test(uname))){
		 	alert("昵称格式错误！昵称长度为2-12位");
		 	document.getElementById("uname").value="";
		 	document.form_reg.uname.focus();
		 	return false;
		 }
		 // 检查手机
		 if(document.form_reg.uphone.value=="")
		 {
		 	alert("请输入手机号");
		 	document.form_reg.uphone.focus();
		 	return false;
		 }
		 var uphone = document.form_reg.uphone.value;
		 var c=/^1[34578]\d{9}$/;
		 if (!(c.test(uphone))) {
		 	alert("手机号码格式错误！");
		 	document.getElementById("uphone").value="";
		 	document.form_reg.uphone.focus();
		 	return false;
		 }

	}
</script>


</body>

</html>